﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;

namespace Pixysoft.Framework.Reflection
{
    class ReflectionHelper
    {
        public static bool IsCloneMethod(MethodInfo method)
        {
            if (method.ReturnType.Equals(typeof(object)) && method.Name.Equals("Clone", StringComparison.OrdinalIgnoreCase))
                return true;

            return false;
        }

        public static bool IsInheritFrom(Type interfaceType, Type inheritType)
        {
            foreach (Type iType in interfaceType.GetInterfaces())
            {
                if (iType.Equals(inheritType))
                    return true;

                if (IsInheritFrom(iType, inheritType))
                    return true;
            }

            return false;
        }
    }
}
